      <div class="templatemo-content-wrapper">
        <div class="templatemo-content">
         <ul class="nav nav-tabs mytabs">
         	 <li class="active"><a href="<?=site_url()?>/school/add">添加学校</a></li>
		  	 <li><a href="<?=site_url()?>/school/index">学校列表</a></li>
		  </ul>
          <div class="row">
            <div class="col-md-12">
              <div class="table-responsive">
                 <form role="form" id="templatemo-preferences-form" onsubmit="return false;">
                  <div class="row">
                  <div class="col-md-6 margin-bottom-15">
                    <label for="firstName" class="control-label">学校名称</label>
                    <input type="text" class="form-control" id="name" value="">                  
                  </div>
                  <div class="col-md-6 margin-bottom-15">
                    <label for="lastName" class="control-label">类型</label>
                    <select class="form-control margin-bottom-15" id="type">
                   	 	<option value="3">小学六年制</option>
                   	 	<option value="1">初中三年制</option>
                   	 	<option value="2">高中三年制</option>
                  	</select>    
                  </div>
                 </div>
	              <div class="row templatemo-form-buttons">
	                <div class="col-md-12">
	                  <button type="submit" class="btn btn-primary" id="submit_btn">添加</button>
	                </div>
               	  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
<script>
	$(document).ready(function() {
		$("#submit_btn").click(function() {
			var name = $("#name").val();
			var type = $("#type").val();

			if(name == ''){
				alert('名字不能为空')
				return;
			}
			
			$.ajax({
				url : '<?php echo site_url('school/save')?>',
				type : "post",
				async : false,
				data : {
					'name' : name,
					'type' : type
				},
				dataType : "json",
				success : function(data) {
					if(data.code)
					{
						alert(data.msg);
						window.location.reload();
					}else{
						alert(data.msg);
					}
				}
			});
		});
	}); 
</script>